package com.ad.backstage.controller;

import com.ad.backstage.service.JielongTimeZoneService;
import com.ad.payload.dto.JielongTimeZoneDto;
import com.ad.payload.model.IdDto;
import com.ad.payload.model.PageView;
import com.ad.payload.vo.JielongTimeZoneVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author:rclia
 * @日期 2021/3/28 10:12
 * @注释
 */
@RestController
@RequestMapping("JielongTimeZoneController")
public class JielongTimeZoneController {

    @Autowired
    private JielongTimeZoneService jielongTimeZoneService;

    /**
     * 分页查询商家接龙时间区段
     *
     * @param idDto
     * */
    @PostMapping("/back/auth/pageJielongTimezone")
    public PageView<JielongTimeZoneVo> pageJielongTimezone(@RequestBody @Valid IdDto idDto){
        return jielongTimeZoneService.pageJielongTimezone(idDto);
    }

    /**
     * 商家段 操作接龙时间段
     * @param jielongTimeZoneDto
     * @return
     */
    @PostMapping("/back/auth/saveOrUpdateJielongTimezone")
    public Long saveOrUpdateJielongTimezone(@RequestBody @Valid JielongTimeZoneDto jielongTimeZoneDto){
        return jielongTimeZoneService.saveOrUpdateJielongTimezone(jielongTimeZoneDto);
    }

    /**
     * 商家段 删除接龙时间段
     * @param idDto
     * @return
     */
    @PostMapping("/back/auth/delJielongTimezone")
    public Long delJielongTimezone(@RequestBody @Valid IdDto idDto){
        return jielongTimeZoneService.delJielongTimezone(idDto);
    }

}
